<?php
header("content-type:text/html;charset=utf-8");

/*
 class Car {
	public $carMode;
	public $carBand;
	public $weight;
	public $speed;

	function getWeight(){
		return $this->weight;
	}
	function getSpeed(){
		return $this->speed;
	}
}

$car1 = new Car();
$car1->carMode = "捷达";
$car1->carBand = "大众";
$car1->weight = 1.5;
$car1->speed = 160;
echo $car1->weight;
echo "</br>";
echo $car1->getWeight();
echo "</br>";
echo $car1->getSpeed();
*/


class Car {
	private $carMode;
	private $carBand;
	private $weight;
	private $speed;

	function Car($m,$b,$w,$s){
		$this->carMode = $m;
		$this->carBnad = $b;
		$this->weight = $w;
		$this->speed = $s;
	}
	function getWeight(){
		return $this->weight;
	}
	function getspeed(){
		return $this->speed;
	}
}

/*$car1 = new Car("捷达","大众",1.5,160);
print_r($car1);
echo "</br>";
echo $car1->getSpeed();
echo "</br>";
echo $car1->getweight();

*/

/*继承性*/
echo "</br>";
class BMWCar extends Car{}
	$bmw1 = new BMWCar("宝马","大众",2,200);
	echo "<pre>";
	print_r($bmw1);
	echo $bmw1->getSpeed();
        echo "</br>";
        echo $bmw1->getWeight();


